package net.sxjr.config;

import net.sxjr.common.RedisService;
import net.sxjr.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author ：cuixc
 * @date ：Created in 2020/9/25 14:09
 * @description：拦截器配置
 * @modified By：
 */
@Configuration
public class MyWebMvcConfig implements WebMvcConfigurer {
    @Autowired
    private RedisService redisService;

    //注册拦截器
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor(redisService))
                .addPathPatterns("/**")
                .excludePathPatterns("/home/login");
    }

}

